<template>
  <div>
    <button @click="sub">-</button>
    <span>{{ number }}</span>
    <button @click="add">+</button>
  </div>
</template>

<script>
export default {
  props: {
    number: {
      type: Number,
      default: 1
    }
  },
  methods: {
    add() {
      this.$emit('update:number', this.number + 1)
    },
    sub() {
      this.$emit('update:number', this.number - 1)
    }
  }
}
</script>

<style lang="scss" scoped>
span {
  margin: 0 10px
}
</style>
